package com.mashibing.controller;

import com.mashibing.dto.ResponseResult;
import com.mashibing.request.VerificationCodeRequest;
import com.mashibing.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
public class UserController {

    @Autowired
    private UserService userService;
    /**
     * 根据用户手机号插入用户
     */
    @PostMapping("/user")
    public ResponseResult loginOrReg(@RequestBody VerificationCodeRequest verificationCodeRequest){
        return userService.loginOrReg(verificationCodeRequest);
    }

    /**
     * 根据手机号查询用户基本信息
     * @param
     * @return
     */
    @GetMapping("/user/{phone}")
    public ResponseResult getUser(@PathVariable("phone")String phone) {
        return userService.getUserByPhone(phone);
    }
}
